Repository navigation
Conversation
Content-type-aware compression of old successful tool results at provider request assembly, behind OPENCODE_MEMORY_CONTEXT flag (off by default). Compacted text keeps call_id, kind, preview and retrieval instruction; originals stay untouched in SQLite history. Failed results, provider-executed tools, memory tools and the recent user turns are never compacted.
Native tool that restores the full original output of a previous tool call by call_id from SQLite session history. Needed so that [mem:compacted tool result] markers from MemoryContext projection honor the 'nothing hidden' philosophy: every compressed result stays retrievable. Searches assistant tool parts and shell messages, supports max_chars truncation, skips undecodable rows instead of failing.
Runs the projection, savings and get_tool_call_details suites on every push/PR plus core typecheck, and writes the measured byte reduction to the job summary so token savings stay visible on each run. Observed on the fixture session: 62041 -> 24081 bytes (61.2% saved), tool payload 63.9% saved.
fix(core): make compacted shell markers retrievable by call_id
The new retrieval builtin broke the expected tool list assertions in location-layer.test.ts.
fix(core): expect get_tool_call_details in location tool list
… location-layer, pin C locale for help snapshots (#3) Co-authored-by: vova <vova@MacBook-Air-50.local>
* ci: unblock fork PR checks and gate full core suite on mem-context workflow Map Blacksmith runners to github-hosted ones when the repository is not anomalyco/opencode so test/unit checks never sit in queued forever; skip e2e and the LLM duplicate-PR check on forks (no Blacksmith, no OPENCODE_API_KEY). Extend mem-context.yml with a blocking full core suite plus opencode typecheck so regressions outside memory-context files fail CI (ISSUES.md CI-1). * ci: make fork unit matrix informational, core suite stays blocking github-hosted runners are slower than Blacksmith: the 15s unknown-model subprocess budget flakes and the Windows ripgrep download times out. continue-on-error on non-upstream repos keeps the signal without failing every fork PR; mem-context.yml core full suite remains the blocking gate. --------- Co-authored-by: vova <vova@MacBook-Air-50.local>
) Native search over session tool calls and shell executions by tool name, status and regex (input/output/error). Returns compact entries with call_id so the full output can be loaded via get_tool_call_details. Complements the memory-context compaction markers: compacted results stay discoverable and retrievable. Co-authored-by: vova <vova@MacBook-Air-50.local>
…#7) * wip: projectV1 memory-context on SessionPrompt path + getToolCallDetails tool - MemoryContext.projectV1 for SessionV1.WithParts (V1 run/TUI path) - wire projectV1 into prompt.ts before toModelMessagesEffect - register getToolCallDetails + findToolCalls in tool registry - add get-tool-call-details.ts (retrieve full output by call_id) - extend memory-context tests for projectV1 * wip: add memory-retrieval-v1 integration test (from dirty tree) * fix(opencode): complete V1 retrieval wiring — title/output in find-tool-calls, instance-scoped tests, readonly spread for projectV1 * fix(core): annotate Candidate type in V1 find-tool-calls --------- Co-authored-by: vova <vova@MacBook-Air-50.local>
…17) Co-authored-by: vova <vova@MacBook-Air-50.local>
…reviews (#18) PII.redact() replaces API keys, Bearer tokens, secret URL query params and Luhn-valid credit cards with self-describing placeholders. Applied to memory context markers (preview, command/url summaries, projected shell command field) and to find_tool_calls model-visible input/preview/error on both V1 and V2 paths. Internal haystack stays raw so regex search still matches originals; get_tool_call_details remains unredacted (authorized exact retrieval). Emails/phones stay tag-only. CI: V1 retrieval test added to mem-context gate. Co-authored-by: vova <vova@MacBook-Air-50.local>
Protection was 'everything from the 3rd-from-last user turn on', so a session with one user prompt (opencode run, first TUI message) had protectedFrom=0 and MEM compacted nothing: real sessions measured 0 markers. Add a second window — the last N assistant messages (N=2, new keepRecentAssistantTurns option) — and take the earlier of the two, so long single-prompt agent loops compress while the model's active working set stays verbatim. Co-authored-by: vova <vova@MacBook-Air-50.local>
…Y_MIDTURN (issue #20) (#22) Default: boundary stays at user-turn boundaries (cache-stable within a turn); the assistant working-set window only applies with midTurn/OPENCODE_MEMORY_MIDTURN=1. Batch boundary from PR #21 still applies when mid-turn is on. Tests: single-turn intact by default, prev turns still compact, env re-enables sliding, batch tests use midTurn: true. memory-context 37/37. Co-authored-by: vova <vova@MacBook-Air-50.local>
…payload (#24) Co-authored-by: vova <vova@MacBook-Air-50.local>
Intent/intent_signal tables + migration, OPENCODE_MEMORY_INTENT* flags, IntentTracker service with deterministic char-ngram cosine detector and extractive delta-refresh, user-turn hook in SessionPrompt.prompt. Log-only: never mutates messages, redacts PII, flag off by default. Co-authored-by: vova <vova@MacBook-Air-50.local>
…_INTENT_CUT (issue #25) (#30) B3 of the IntentTracker plan: a confirmed intent switch finalizes the closed intent's segment in the model-visible projection. The user message that opened the active intent becomes the compaction boundary — tool outputs the keep-window would protect turn into retrieval markers, while the new intent's segment stays verbatim. Cache-breaking (prefix edit at the switch point), so the feature is off by default: OPENCODE_MEMORY_INTENT_CUT gates the tracker reader, and the projection only applies the boundary when intentSwitchMessageID is passed. Unknown message IDs fall back to the normal boundary; once later user turns move the sliding window past the switch the cut is subsumed, keeping the projected prefix monotone. Co-authored-by: vova <vova@MacBook-Air-50.local>
* wip(groom): verbatim-prefix mark — sentCount = identity prefix length (issue #29) * fix(core,opencode): cache-mark floors only the verbatim prefix (issue #29) The ledger used to set mark_index to the full projected length, so compacted messages fell below the grown mark and were re-sent as raw originals — mutating the provider's cached marker prefix and re-uploading the full bulk every turn (fdmark arm cost ≈ off instead of ≈ fd). - recordUsage sentCount is now CacheMark.verbatimPrefixLength(projected, raw): only leading messages the projection left byte-identical may be floored; compacted tail stays above the mark and re-compacts to the same marker bytes (append-only prefix). - markIndexFor: no ledger row means the provider confirmed nothing (mark=0, whole history eligible) instead of failing safe to a verbatim send; verbatim fail-safe is kept for real integrity failures (prefix hash mismatch, history shrank below the mark). Refs #29
#39) (#41) A failed, timed-out or aborted attempt leaves the provider cache unverifiable, so keeping the confirmed mark resuscitates a full verbatim prefix into a cold cache. Reset the ledger row to zero (pending verification) on stream/provider failures; the next confirmed response self-heals it from usage. Context overflow is excluded: the provider rejected the request before touching the cache.
…(issue #39) (#47) A confirmed mark older than OPENCODE_MEMORY_MARK_IDLE_MS (default 30 min) is treated as cold: markIndexFor returns 0 and the request carries the compact projection instead of a verbatim prefix the provider most likely no longer holds. Applied on the first step of a turn only — mid-turn an in-flight task owns the cache and time alone never resets the mark. The ledger row is left untouched, so the next confirmed response re-warms it through applyUsage. Refs #39
#45) (#46) * fix(core): route MEM debug stats to server log instead of stdout (issue #45) console.log in memory-context.project/projectV1 wrote [mem-context] ... to stdout, which the opencode server inherits from the TUI/terminal client, leaking internal projection stats into the user's view. Append the same line to Global.Path.log/memory-context.log instead; OPENCODE_MEMORY_CONTEXT_DEBUG stays opt-in debug. Regression test: with the flag on, compacting messages writes nothing to stdout. * refactor(core): extract MemDebugLog shared server-log writer (WIP) Generalize the memory-context debugLog helper into a reusable MemDebugLog.write(file, line) module so other MEM debug emitters (intent-tracker etc.) can share the server-log-not-stdout path (issue #45). --------- Co-authored-by: vova <vova@MacBook-Air-50.local>
* fix(session): report silent and disconnected runs truthfully (#75) * fix(run): emit terminal JSON error only once * fix(notification): defer ladder errors until terminal idle
* test(core): allow cold Windows ripgrep extraction (#76) * fix(core): extract Windows ripgrep with tar * fix(core): use system tar on Windows * ci: gate Windows ripgrep tests separately
* test(core): isolate test files to release Windows runner * test(ci): use current Bun on Windows * test(ci): isolate Windows location layer exit probe * test(ci): bisect Windows core test exit by file group * test(ci): split Windows core suite into bounded processes * test(ci): preserve test environment in Windows shards * test(opencode): stabilize Windows path and CLI timing assertions * test(ci): bound full Windows OpenCode suite in four processes * test(ci): build OpenCode dependencies before split suite * test(ci): isolate Windows OpenCode suites into smaller chunks * test(opencode): bound cold Windows instance bootstrap separately * test: allow Windows ACP and server startup latency --------- Co-authored-by: vova <vova@MacBook-Air-50.local>
test(ci): bound and trace HttpApi exerciser gates
test(ci): narrow Windows test batches
Refs #76. Full Linux and Windows unit suites, mem-context core/retrieval tests, Windows ripgrep gate, and standards checks passed. The LLM duplicate detector is an advisory queued check; all validation jobs passed.
* fix(compaction): preserve full tool output for summaries * test: allow Windows attach shutdown timing variance
* fix(llm): suppress repeated control-marker stream artifacts * test: allow Windows attach shutdown timing variance
…it (#115) * feat(opencode): add skill delivery hooks and graceful opencode-mem init * feat(opencode): add pdf_read tool --------- Co-authored-by: vova <vova@MacBook-Air-50.local>
…cache Keeps the worktree clean after local builds: packages/posts/.astro, services/www/.astro and packages/cli/.cache/bun-app-archive.bin (24 MB) are all regenerated artifacts, never hand-edited.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 72 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: |
|
groom: закрываю — PR собран не от той базы. Ветка |
Что
Дерево форка перестаёт быть грязным после локальной сборки: 13 untracked-файлов — это
packages/posts/.astro/*,services/www/.astro/*(astro typegen) иpackages/cli/.cache/bun-app-archive.bin(24 МБ бинарь). Ни один не редактируется руками.Зачем
Groom-прогоны тратят время на разбор «а это работа или артефакт?», а
git statusв рабочем клоне всегда непустой. Артефакты регенерируются сборкой, терять нечего.Проверка
git status --porcelain -uallдо: 13 строк; после: 0..gitignore.